package ym.controller.front.website;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ym.pojo.Category;
import ym.service.CategoryService;
import ym.vo.BaseResult;

/**
 * 广告
 */
@RestController
@CrossOrigin
@RequestMapping("/front/category")
public class FrontCategoryCon {
    @Autowired
    private CategoryService categoryService;

    /**
     * 根据类型分页查询【状态为可用】
     *
     * @param categoryTypeId
     * @param page
     * @param size
     * @return
     */
    @GetMapping("/searchByTypeWithStatus")
    public BaseResult searchByTypeWithStatus(Integer categoryTypeId, int page, int size) {
        Page<Category> categoryPage = categoryService.searchByTypeWithStatus(categoryTypeId, page, size);
        return BaseResult.ok(categoryPage);
    }
}
